import mitt from 'mitt'
import router from '../router'

export default {
  data: {},
  push(url, data) {
    this.data = data || {};
    router.push(url);
  },
  pop(n = 1) {
    this.data = {};
    router.go(-n);
  },
  replace(url, data) {
    this.data = data || {};
    router.replace(url);
  },
  $bus: mitt(),
}